# -*- conding:UTF-8 -*-

'''
@ Project: funny
@ File: turn.py
@ Author: 韩成瑾
@ Date：2022/10/13 20:01

'''


# 将英语单词列表转换成MP3模式

import os

from pydub import AudioSegment  # 先导入这个模块
import datetime


def pinjie(mp3_path_list, out_div):
    out_name = datetime.datetime.now().strftime('[%Y-%m-%d]%H-%M-%S.mp3')
    output_music = None
    first = True
    for mp3_path in mp3_path_list:
        if first:
            first = False
            input_music_1 = AudioSegment.from_mp3(mp3_path)
            output_music = input_music_1
        else:
            input_music_1 = AudioSegment.from_mp3(mp3_path)
            output_music += input_music_1  # 打开音频后，直接使用+运算符就可以将两段拼接在一起

    output_music.export(out_div + "\\" + out_name, format="mp3")  # 输出合并之后的音频

    print(len(output_music), output_music.channels)  # 打印一下合并后音频的信息






















